-
Notifications
You must be signed in to change notification settings - Fork 635
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
qml.grouping.is_pauli_word
returns false for non-observables
#3039
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've searched GitHub and all code that invokes is_pauli_word
raises a TypeError when it returns False anyway (with the exception of the accused _obs_has_kernel
in various plugins), so this makes good sense to me. It logically follows too: "Is my random non-observable operator a pauli word?" "no". lgtm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like a simple enough change. I imagine this code will have to get changed again in the future when we integrate op_math
Codecov Report
@@ Coverage Diff @@
## master #3039 +/- ##
=======================================
Coverage 99.66% 99.66%
=======================================
Files 269 269
Lines 22892 22892
=======================================
Hits 22815 22815
Misses 77 77
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
Co-authored-by: Jay Soni <[email protected]>
For PennyLane Lightning PR #349, I am trying to get adjoint differentiation working with operator arithmetic observables.
On that PR branch, I try:
Only to get the error (tail end of traceback only):
This occurs because we no longer only measure observables.
Sum
,Prod
, andSProd
are only plainOperator
's.So we simply return
False
if the provided object is not a Pauli Word. Non-observables are obviously not Pauli Words.This may also improve PR #3033 .